let fs = require('fs');
let buf = '';

process.stdin.on('readable', function() {
    let chunk = process.stdin.read();
    if (chunk) buf += chunk.toString();
});

process.stdin.on('end', function() {
    let [s, e] = buf.split(" ").map(function(x){return parseInt(x);});
    if (s < e) console.log(`O JOGO DUROU ${e - s} HORA(S)`);
    else console.log(`O JOGO DUROU ${24 - s + e} HORA(S)`);
});